package com.realgodo.site.entity.relation;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.realgodo.site.entity.IdEntity;
import com.realgodo.site.entity.space.Space;

@Entity(name = "FriendCatalog")
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "friend_catalog")
public class FriendCatalog extends IdEntity{

	/** */
	private static final long serialVersionUID = -1054171392783381270L;
	
	public static final Long DEFAULT =1l;
	
	public static final int IS=1;
	public static final int IS_NOT=0;
	
	private Space space;//所有人
	
	private String name;
	
	private int isDefault = IS_NOT;//是否为默认 =1不可删除
	
	private int friendNum;//分类下朋友数量

//	private FriendCatalog parent;
//	
//	private List<FriendCatalog> children;
	
//	@OneToMany(fetch = FetchType.EAGER, mappedBy = "parent",cascade = CascadeType.REMOVE)
//	public List<FriendCatalog> getChildren() {
//		return children;
//	}
//
//	public void setChildren(List<FriendCatalog> children) {
//		this.children = children;
//	}
//
//	@ManyToOne
//	@JoinColumn(name = "parent_id", referencedColumnName = "id", nullable = true)
//	public FriendCatalog getParent() {
//		return parent;
//	}
//
//	public void setParent(FriendCatalog parent) {
//		this.parent = parent;
//	}

	@ManyToOne
	@JoinColumn(name = "space_id", referencedColumnName = "id", nullable = true)
	public Space getSpace() {
		return space;
	}

	public void setSpace(Space space) {
		this.space = space;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "is_default")
	public int getIsDefault() {
		return isDefault;
	}

	public void setIsDefault(int isDefault) {
		this.isDefault = isDefault;
	}

	@Column(name = "friend_num")
	public int getFriendNum() {
		return friendNum;
	}

	public void setFriendNum(int friendNum) {
		this.friendNum = friendNum;
	}
	
	

}
